﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WaterRevenueMS.Domain.Common.Models;
using System.Web.Mvc;
using System.ComponentModel.DataAnnotations;

namespace WaterRevenueMS.Domain.ViewModels.BasicSet.ConsumptionAbnormal
{
    //new SelectListItem { Text = "是", Value = "1" }, 
   //             new SelectListItem { Text = "否", Value = "0" }
    public class ConsumptionAbnormalModel : EntityCommon
    {
        public ConsumptionAbnormalModel()
        {
            Search = new SearchModel();
            {
                DefaultValue = 0;
                Xia_XBJItems = new List<SelectListItem>() {
                new SelectListItem { Text = "--- 下限警报 ---", Value = "-1"}, 
                new SelectListItem { Text = "不启用", Value = "0" },
                new SelectListItem { Text = "固定值比较", Value = "1" },
                new SelectListItem { Text = "与上月用量比较(百分比)", Value = "2" },
                new SelectListItem { Text = "与上N月平均用量比较(百分比)", Value = "3" }
                };

                Shang_XBJItems = new List<SelectListItem>() {
                new SelectListItem { Text = "--- 下限警报 ---", Value = "-1"}, 
                new SelectListItem { Text = "不启用", Value = "0" },
                new SelectListItem { Text = "固定值比较", Value = "1" },
                new SelectListItem { Text = "与上月用量比较(百分比)", Value = "2" },
                new SelectListItem { Text = "与上N月平均用量比较(百分比)", Value = "3" }
                };

            };
        }

        public int Id { get; set; }


        [Display(Name = "异常规则")]
        public string Yi_CGZ { get; set; }

        public byte DefaultValue { get; set; }



        [Display(Name = "下限报警")]
        public List<SelectListItem> Xia_XBJItems { get; set; }

        public byte Xia_XBJValue { get; set; }
       // public string  Xia_XBJName { get; set; }
        [Display(Name = "用量下限")]
        public float Yong_LXX { get; set; }
        [Display(Name = "下限百分比")]
        public float Xia_XBFB { get; set; }
        public byte Xia_XGZ { get; set; }



        [Display(Name = "上限报警")]
        public List<SelectListItem> Shang_XBJItems { get; set; }
        public byte Shang_XBJValue { get; set; }
      //  public string Shang_XBJName { get; set; }
        [Display(Name = "用量上限")]
        public float Yong_LSX { get; set; }
        [Display(Name = "上限百分比")]
        public float Shang_XBFB { get; set; }
        public byte Shang_XGZ { get; set; }

        [Display(Name = "排序序号")]
        public int OrderNo { get; set; }

        public string Xia_XBJName
        {
            get
            {
                if (Xia_XBJValue == 0)
                {
                    return "不启用";
                }
                else
                {
                    if (Xia_XBJValue == 1)
                    {
                        return "固定值比较";
                    }
                    else
                    {
                        if (Xia_XBJValue == 2)
                        {
                            return "与上月用量比较(百分比)";
                        }
                        else
                        {
                            return "与上N月平均用量比较(百分比)";

                        }
                    
                    }
                   // return "";
                }

            }
            set { }
        }
        public string Shang_XBJName
        {
            get
            {
                if (Shang_XBJValue == 0)
                {
                    return "不启用";
                }
                else
                {
                    if (Shang_XBJValue == 1)
                    {
                        return "固定值比较";
                    }
                    else
                    {
                        if (Shang_XBJValue == 2)
                        {
                            return "与上月用量比较(百分比)";
                        }
                        else
                        {
                            return "与上N月平均用量比较(百分比)";

                        }

                    }
                    // return "";
                }

            }
            set { }
        }


        public SearchModel Search { get; set; }
    }
    public class SearchModel
    {
        public SearchModel()
        {
            DefaultValue = 0;
            Xia_XBJItems = new List<SelectListItem>() {
                new SelectListItem { Text = "--- 下线警报 ---", Value = "-1"}, 
                new SelectListItem { Text = "不启用", Value = "0" },
                new SelectListItem { Text = "固定值比较", Value = "1" },
                new SelectListItem { Text = "与上月用量比较(百分比)", Value = "2" },
                new SelectListItem { Text = "与上N月平均用量比较(百分比)", Value = "3" }
                };

            Shang_XBJItems = new List<SelectListItem>() {
                new SelectListItem { Text = "--- 下线警报 ---", Value = "-1"}, 
                new SelectListItem { Text = "不启用", Value = "0" },
                new SelectListItem { Text = "固定值比较", Value = "1" },
                new SelectListItem { Text = "与上月用量比较(百分比)", Value = "2" },
                new SelectListItem { Text = "与上N月平均用量比较(百分比)", Value = "3" }
                };
        }


        public int Id { get; set; }


        [Display(Name = "异常规则")]
        public string Yi_CGZ { get; set; }
        public byte DefaultValue { get; set; }


        [Display(Name = "下限报警")]
        public List<SelectListItem> Xia_XBJItems { get; set; }
        public byte Xia_XBJValue { get; set; }
        public string Xia_XBJName { get; set; }
        [Display(Name = "用量下限")]
        public float Yong_LXX { get; set; }
        [Display(Name = "下限百分比")]
        public float Xia_XBFB { get; set; }
        public byte Xia_XGZ { get; set; }



        [Display(Name = "上限报警")]
        public List<SelectListItem> Shang_XBJItems { get; set; }
        public byte Shang_XBJValue { get; set; }
        public string Shang_XBJName { get; set; }
        [Display(Name = "用量上限")]
        public float Yong_LSX { get; set; }
        [Display(Name = "上限百分比")]
        public float Shang_XBFB { get; set; }
        public byte Shang_XGZ { get; set; }

        [Display(Name = "排序序号")]
        public int OrderNo { get; set; }


    }
}
